package com.zhaoyue.study.util;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.util.List;

/**
 * @author zhaoyue
 * @description:
 * @create 2018-11-20 下午7:37
 **/
public class FileUtilsDemo {

    public static void main(String[] args) throws Exception {

        List<String> list = FileUtils.readLines(new File("d://demo.txt"),"UTF-8");
            list.forEach(v -> System.out.println("内容:" + v)
        );

        String string = FileUtils.readFileToString(new File("d://demo.txt"),"UTF-8");
        String[] array = StringUtils.split(string);
        System.out.println("第一行:" + array[0]);
        System.out.println("第二行:" + array[1]);

        //FileUtils.copyDirectory("","");
    }
}
